package core.datasource.routing;

import org.springframework.util.Assert;

public class CustomContextHolder {
	 
	   private static final ThreadLocal<ConnectionType> contextHolder =
	            new ThreadLocal<ConnectionType>();
	 
	   public static void setConnectionType(ConnectionType connectionType) {
	      Assert.notNull(connectionType, "connectionType cannot be null");
	      contextHolder.set(connectionType);
	   }
	 
	   public static ConnectionType getConnectionType() {
	      return (ConnectionType) contextHolder.get();
	   }
	 
	   public static void clearConnectionType() {
	      contextHolder.remove();
	   }
	}
